<%--                                                                       --%>
<%-- Copyright (c) 2003-2005 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%
  String ctxPath = request.getContextPath();
%>

<script language="JavaScript">

  function doEditAction(alerttype) {
    document.bpProcessTaskForm.alertType.value=alerttype;
    document.bpProcessTaskForm.action = '<html-el:rewrite page="/bp/processTaskAlertEdit.do"/>';
    document.bpProcessTaskForm.submit();
  }

  function doEditEnableAction(alerttype) {
    document.bpProcessTaskForm.alertType.value=alerttype;
    document.bpProcessTaskForm.action = '<html-el:rewrite page="/bp/processTaskAlertEditEnable.do"/>';
    document.bpProcessTaskForm.submit();
  }

  function doEditDisableAction(alerttype) {
    document.bpProcessTaskForm.alertType.value=alerttype;
    document.bpProcessTaskForm.action = '<html-el:rewrite page="/bp/processTaskAlertEditDisable.do"/>';
    document.bpProcessTaskForm.submit();
  }

</script>

<% 
  java.util.HashMap map = new java.util.HashMap();
  String procOid = request.getParameter("processOid"); 
  String taskNumber = request.getParameter("number"); 
  if (procOid != null && procOid.length() > 0 && taskNumber != null && taskNumber.length() > 0) {
    map.put("processOid", procOid);
    map.put("number", taskNumber);
  }
  else {
    map.put("processOid", "-1");
    map.put("number", "-1");
  }
  pageContext.setAttribute("pagetabParam", map, PageContext.PAGE_SCOPE);
%>

<c:set var="editImg">
<img src="<%= ctxPath %>/mc/images/action/icon_edit.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean-el:message key="image.alt.edit" bundle="mc.messages"/>" title="<bean-el:message key="image.alt.edit" bundle="mc.messages"/>">
</c:set>
<c:set var="onlineImg">
<img src="<%= ctxPath %>/mc/images/action/icon_online.gif" width="15" height="15" border="0" class="actionIcon" alt='<bean:message key="image.alt.enable" bundle="bp.messages"/>' title='<bean:message key="image.alt.enable" bundle="bp.messages"/>'>
</c:set>
<c:set var="offlineImg">
<img src="<%= ctxPath %>/mc/images/action/icon_offline.gif" width="15" height="15" border="0" class="actionIcon" alt='<bean:message key="image.alt.disable" bundle="bp.messages"/>' title='<bean:message key="image.alt.disable" bundle="bp.messages"/>'>
</c:set>

<html-el:form action="/bp/processTaskAlertView.do">
<html-el:hidden name="bpProcessTaskForm" property="processOid"/>
<html-el:hidden name="bpProcessTaskForm" property="number"/>
<input type="hidden" name="alertType"/>
<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">
      <div class="pageTitle"><bean:write name="processTaskAlertView" property="processName"/></div>
      <div class="errorMessage"><html-el:errors bundle="bp.messages"/></div>
      <%@include file="/mc/common/pagetab.jsp" %>
      <div class="breadcrumb">
        <logic:present name="processSubprocessPath" scope="session">
          <logic:greaterThan name="processSubprocessPath" property="processOid" value="0">
            <html-el:link page="/bp/processSubprocessView.do" paramId="processOid" paramName="processSubprocessPath" paramProperty="processOid">
              <bean:write name="processSubprocessPath" property="processName"/>
            </html-el:link>
            <logic:iterate id="subprocess" name="processSubprocessPath" property="subprocesses" indexId="i">
              &nbsp;<bean:message key="bp.process.taskSeparator" bundle="bp.messages"/>&nbsp;
              <html-el:link page="/bp/processSubprocessTaskView.do" name="subprocess" property="parameterTaskMap">
                <bean:write name="subprocess" property="number"/>:
                <bean:write name="subprocess" property="friendlyName"/>
              </html-el:link>
              &nbsp;<bean:message key="bp.process.taskSeparator" bundle="bp.messages"/>&nbsp;
              <html-el:link page="/bp/processSubprocessView.do" name="subprocess" property="parameterMap">
                <bean:write name="subprocess" property="subprocessName"/>
              </html-el:link>
            </logic:iterate>
          </logic:greaterThan>
        </logic:present>
        <logic:present name="processSubprocessPath" scope="session">
          <logic:equal name="processSubprocessPath" property="processOid" value="0">
            <html-el:link page="/bp/processView.do" paramId="processOid" paramName="bpProcessTaskForm" paramProperty="processOid">
              <bean:write name="processTaskAlertView" property="processName"/>
            </html-el:link>
          </logic:equal>
        </logic:present>
        <logic:notPresent name="processSubprocessPath" scope="session">
          <html-el:link page="/bp/processView.do" paramId="processOid" paramName="bpProcessTaskForm" paramProperty="processOid">
            <bean:write name="processTaskAlertView" property="processName"/>
          </html-el:link>
        </logic:notPresent>
        &nbsp;<bean:message key="bp.process.taskSeparator" bundle="bp.messages"/>&nbsp;
        <bean:write name="bpProcessTaskForm" property="number"/>:
        <bean:write name="processTaskAlertView" property="friendlyName"/>
      </div>
      <div class="pageSubtitle">
        <span class="left"><bean:message key="bp.process.processTaskAlert.information" bundle="bp.messages"/></span>
        <span class="right">&nbsp;</span>
      </div> 
      <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="Search result table" width="100%">
        <tr class="listHeader">
          <th id="AlertType" align="left">
            <bean:message key="bp.process.processTaskAlert.header.alertType" bundle="bp.messages"/>
          </th>
          <th id="DeliveryType" align="left">
            <bean:message key="bp.process.processTaskAlert.header.deliveryType" bundle="bp.messages"/>
          </th>
          <th id="Status" align="left">
            <bean:message key="header.status" bundle="bp.messages"/>
          </th>
          <th id="SendTo" align="left">
            <bean:message key="bp.process.processTaskAlert.header.sendTo" bundle="bp.messages"/>
          </th>
          <th id="AlertOthers" align="left">
            <bean:message key="bp.process.processTaskAlert.header.alertOthers" bundle="bp.messages"/>
          </th>
          <th id="Actions" align="left" nowrap>
            <bean:message key="header.actions" bundle="bp.messages"/>
          </th>
        </tr>
        <logic:iterate id="alert" name="processTaskAlertView" property="alerts" indexId="i">
          <tr class="<%=i.intValue() % 2 == 0 ? "listEven" : "listOdd" %>">
            <td headers="AlertType">
              <logic:equal name="alert" property="alertType" value="0">
                <bean:message key="bp.process.processTaskAlert.alertType.reminder" bundle="bp.messages"/>
              </logic:equal>
              <logic:equal name="alert" property="alertType" value="1">
                <bean:message key="bp.process.processTaskAlert.alertType.taskCompletion" bundle="bp.messages"/>
              </logic:equal>
              <logic:equal name="alert" property="alertType" value="2">
                <bean:message key="bp.process.processTaskAlert.alertType.taskAvailable" bundle="bp.messages"/>
              </logic:equal>
              <logic:equal name="alert" property="alertType" value="3">
                <bean:message key="bp.process.processTaskAlert.alertType.taskAssignment" bundle="bp.messages"/>
              </logic:equal>
              <logic:equal name="alert" property="alertType" value="5">
                <bean:message key="bp.process.processTaskAlert.alertType.overdue" bundle="bp.messages"/>
              </logic:equal>
            </td>
            <td headers="DeliveryType">
              <logic:equal name="alert" property="exist" value="false">
                <bean:message key="bp.process.processTaskAlert.unspecified" bundle="bp.messages"/>
              </logic:equal>
              <logic:equal name="alert" property="exist" value="true">
                <logic:equal name="alert" property="deliveryType" value="1">
                  <bean:message key="bp.process.processTaskAlert.deliveryType.email" bundle="bp.messages"/>
                </logic:equal>
                <logic:equal name="alert" property="deliveryType" value="0">
                  <bean:message key="bp.process.processTaskAlert.deliveryType.inbox" bundle="bp.messages"/>
                </logic:equal>
              </logic:equal>
            </td>
            <td headers="Status">
              <logic:equal name="alert" property="exist" value="true">
                <logic:equal name="alert" property="enabled" value="true">
                  <bean:message key="bp.process.processTaskAlert.status.enabled" bundle="bp.messages"/>
                </logic:equal>
                <logic:equal name="alert" property="enabled" value="false">
                  <bean:message key="bp.process.processTaskAlert.status.disabled" bundle="bp.messages"/>
                </logic:equal>
              </logic:equal>
              <logic:equal name="alert" property="exist" value="false">
                <bean:message key="bp.process.processTaskAlert.status.disabled" bundle="bp.messages"/>
              </logic:equal>
            </td>
            <td headers="SendTo">
              <logic:equal name="alert" property="sendToManager" value="true">
                <bean:message key="bp.process.processTaskAlert.sendTo.manager" bundle="bp.messages"/>
              </logic:equal>
              <logic:equal name="alert" property="sendToManager" value="true">
              <logic:equal name="alert" property="sendToPerformer" value="true">
                <br>
              </logic:equal>
              </logic:equal>
              <logic:equal name="alert" property="sendToPerformer" value="true">
                <bean:message key="bp.process.processTaskAlert.sendTo.performer" bundle="bp.messages"/>
              </logic:equal>
            </td>
            <td headers="AlertOthers">
              <logic:present name="alert" property="userRecipients">
                <logic:iterate id="userRecipient" name="alert" property="userRecipients" indexId="j">
                  <bean:write name="userRecipient"/><br>
                </logic:iterate>
              </logic:present>
              <logic:present name="alert" property="groupRecipients">
                <logic:iterate id="groupRecipient" name="alert" property="groupRecipients" indexId="k">
                  <bean:write name="groupRecipient"/><br>
                </logic:iterate>
              </logic:present>
            </td>
            <td nowarp headers="Actions" align="left">
              <logic:equal name="alert" property="exist" value="true">
                <a href='#' onclick="doEditAction('<bean:write name="alert" property="alertType"/>');"><c:out value='${editImg}' escapeXml="false"/></a>
                <logic:equal name="alert" property="enabled" value="true">
                  <a href='#' onclick="doEditDisableAction('<bean:write name="alert" property="alertType"/>');"><c:out value='${offlineImg}' escapeXml="false"/></a>
                </logic:equal>
                <logic:equal name="alert" property="enabled" value="false">
                  <a href='#' onclick="doEditEnableAction('<bean:write name="alert" property="alertType"/>');"><c:out value='${onlineImg}' escapeXml="false"/></a>
                </logic:equal>
              </logic:equal>
              <logic:equal name="alert" property="exist" value="false">
                <a href='#' onclick="doEditAction('<bean:write name="alert" property="alertType"/>');"><c:out value='${onlineImg}' escapeXml="false"/></a>
              </logic:equal>
            </td>
          </tr>
        </logic:iterate>
      </table>
    </td>
  </tr>
</table>
</html-el:form>
